package com.itheima.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by crowndint on 2018/10/1.
 *
 *  生产者/消费者模式, 靠谱模式 也叫点对点模式
 *
 *  1、确保消息能够被收到，消息会保存到消息队列
 *  2、只有一个消费者能够收到消息
 *
 */
@RestController
public class MsgProducerController {

    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    @RequestMapping("send")
    public void send(String msg) {

        jmsMessagingTemplate.convertAndSend("itheima", msg);
    }


}
